package com.wunong.smart.collection.domain.state.impl;

import com.wunong.smart.collection.application.request.CancelCollectionRequest;
import com.wunong.smart.collection.application.request.CollectRequest;
import com.wunong.smart.collection.client.enums.CollectionStatusEnum;
import com.wunong.smart.collection.domain.model.CollectionDomain;
import com.wunong.smart.collection.domain.state.AbstractCollectionState;
import org.springframework.stereotype.Component;

/**
 * 收藏中状态：
 * 支持 收藏、取消收藏 操作
 *
 * @author create by zealot.zt
 */
@Component
public class CollectingCollectionState extends AbstractCollectionState {

    @Override
    public Long collect(CollectRequest request, CollectionDomain domain) {
        return (Long) operate(request, domain);
    }

    @Override
    public Void cancel(CancelCollectionRequest request, CollectionDomain domain) {
        operate(request, domain);
        return null;
    }

    @Override
    public Integer getStatus() {
        return CollectionStatusEnum.COLLECTING.getCode();
    }

}
